package com.wuwei.elearning.question.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.wuwei.elearning.question.domain.Question;
import com.wuwei.elearning.question.domain.QuestionItem;
import com.wuwei.elearning.question.domain.TestResult;
import com.wuwei.elearning.question.vo.GetResultVo;
import com.wuwei.elearning.question.vo.PageVo;
import com.wuwei.elearning.question.vo.QuestionVo;
import com.wuwei.elearning.question.vo.TestVo;
import com.wuwei.elearning.setting.domain.User;
import com.wuwei.elearning.utils.result.Result;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 每个单独的问题都会生成一个question_item 服务类
 * </p>
 *
 * @author wuwei
 * @since 2024-01-17
 */
public interface QuestionItemService extends IService<QuestionItem> {

    /**
     * 根据出题的科目，比如是M1还是M2以及出题数量来出题，将出的题目添加到mysql数据库中
     * @param questionVo 请求数据
     * @param account 用户账号
     * @return
     */
    Result<String> batchInsert(Long account, QuestionVo questionVo);

    Result<Map<String, Object>> batchGet(Long groupId, Long account);

    /**
     * 教师查看考卷的方法
     * @param questionItemId
     * @return
     */
    Result<Map<String, Object>> getItem(Long questionItemId);

    Result<String> submit(TestVo testVo, Long account);

    List<QuestionItem> getResultList(PageVo<GetResultVo> resultVoPageVo);

    Long getResultTotal(GetResultVo resultVoPageVo);

    /**
     * 学员查看考卷的方法
     * @param questionItemId
     * @return
     */
    Result<Map<String, Object>> checkForStudent(Long questionItemId, Long account);

    Result<String> delete(Long questionItemId, Long account);

    /**
     * 根据随堂练习的类型和科目获取相应的题目清单
     * @param type 支持的随堂练习有顺序练习，随机练习，错题练习，收藏练习
     * @param selectedId 如果小于10000，则为chapter表中的id字段，如果大于10000，则为subject表的id加上10000
     * @return
     */
    List<Question> getLearnItems(String type,Long selectedId, Long account);

    Result<String> batchDelete(List<QuestionItem> questionItems,Long account);

    Map<String,Object>  selectQuestionItems(String title, User user, Integer currentPage, Integer pageSize);

    /**
     * 查询该学员还有多少道试卷未做
     * @return
     */
    Integer getCountByAccount(User user);


}
